#include "stdafx.h"
#include "Statement.h"

CStatementIf::CStatementIf(CVariable *left, CVariable *right,
						   bool not, CompType comp)
{
	m_Type = tStatementIf;
	m_Not = not;
	m_ExecPos = 0;
	m_Else = false;
	m_Left = left;
	m_Right = right;
	m_CompType = comp;
}

CStatementIf::CStatementIf()
{
}

CStatementIf::~CStatementIf()
{
	// add code to free memory used by statement lists
}

void CStatementIf::AddStatement(CStatement *var)
{
	m_Else ? m_ElseStatements.push_back(var) : m_IfStatements.push_back(var);
}

void CStatementIf::FlagElse()
{
	m_Else = true;
}

bool CStatementIf::Execute()
{
	bool rtn = true;

	if(m_ExecPos == 0)
	{
		// need to evaluate statement
		// if its true, use ifStatements list
		// if its false, execuse else, unless elseStatements is false
		// if elseStatements is empty, return true
	}
	else
	{
		// execute saved statements
	}

	return rtn;
}